#ifndef STL_LEARN_TEST_PRINT_HPP__
#define STL_LEARN_TEST_PRINT_HPP__

#include <iostream>
#include <sstream>
using std::cout;
using std::endl;

static std::ostringstream string_out;

// 一个灵活的输出函数
// Example: print("One line", "is One line");
inline static void print() {
    cout << endl;
}

// 接受多行输出的 print
// Example: print(out, "first line", "second line");
inline static std::ostream& print(std::ostream& out) {
    return out;
}

// static fix multiple definitions
template <typename T, typename... Ts>
static void print(const T& firstArg, const Ts&... args) {
    cout << firstArg;
    print(args...);
}

template <typename T, typename... Ts>
static std::ostream& print(std::ostream& out, const T& firstArg, const Ts&... args) {
    out << firstArg << endl;
    return print(out, args...);
}

#endif
